home *** CD-ROM | disk | FTP | other *** search
- Path: keats.ugrad.cs.ubc.ca!not-for-mail
- From: c2a192@ugrad.cs.ubc.ca (Kazimir Kylheku)
- Newsgroups: comp.lang.c
- Subject: Re: What is &Variable (declared as: char Variable[10])?
- Date: 6 Mar 1996 12:55:22 -0800
- Organization: Computer Science, University of B.C., Vancouver, B.C., Canada
- Message-ID: <4hku3qINNrok@keats.ugrad.cs.ubc.ca>
- References: <4gqpa1$3h9@alcor.usc.edu> <TANMOY.96Feb29100937@qcd.lanl.gov> <4hdtfcINN4l3@keats.ugrad.cs.ubc.ca> <TANMOY.96Mar4081026@qcd.lanl.gov>
- NNTP-Posting-Host: keats.ugrad.cs.ubc.ca
-
- In article <TANMOY.96Mar4081026@qcd.lanl.gov>,
- Tanmoy Bhattacharya <tanmoy@qcd.lanl.gov> wrote:
- >In article <4hdtfcINN4l3@keats.ugrad.cs.ubc.ca>
- >c2a192@ugrad.cs.ubc.ca (Kazimir Kylheku) writes:
- >The difference you are trying to make between `value context' and
- >`object context' (or `lvalue context') is a good way of understanding
- >what is going on. In fact, I prefer this method of explaining it to
- >beginners as well; though strictly speaking it is incorrect.
-
- Right. The concept ignores the fact that some evaluations are simply undefined,
- and that they may have side effects which are not generated if you don't
- evaluate. What I should have said more clearly is that the value _type_ is
- conceptually generated, not the value itself. For example, in sizeof(array), or
- &array it is harmless to think of the expression array has having, at compile
- time, an indeterminate _value_, but whose _type_ is surely pointer to T,
- whatever the base type is. The code to actually compute the missing pointer to
- T is never generated, because the nature of & and sizeof() doesn't call for it.
- I did not mean to imply that one should imagine that the expression is
- evaluated followed by a dropping of the value.
-
- This is a harmless way to think about it that might be suitable for teaching
- purposes. It does call upon all kinds of concepts that are probably unfamiliar
- to beginner programmers---things like attributes of a parse tree node, concepts
- that only come naturally because I have grappled with them in the study of
- compiler construction. Perhaps this sort of thing should be taught first. I
- would readily whip out parse tree diagrams labelled with attributes if that
- would help.
- --
-
-